from metavision_core.event_io.raw_reader import RawReader
from metavision_core.event_io.raw_writer import RawWriter  # 修改导入路径

# 输入文件路径
raw_file = "E:/Datasets/uav_event&rgb/2025-01-10_12_54_54.raw"   # 替换为你的 .raw 文件路径
output_file = "E:/Datasets/uav_event&rgb/2025-01-10_12_54_54.aedat4"  # 转换后的文件路径

# 初始化事件读取器
reader = RawReader(raw_file)

# 初始化事件写入器
writer = RawWriter(output_file)

# 逐帧读取 raw 文件并写入 aedat4
for ev_buffer in reader:
    writer.write(ev_buffer)

writer.close()
print(f"转换完成！文件已保存为 {output_file}")